package 狂神多线程;
//测试join方法,,想象成插队
public class TestJoin implements Runnable{
    @Override
    public void run() {
        for (int i=0;i<1000;i++){
            System.out.println("vip来了:"+i);
        }
    }

    public static void main(String[] args) {
        TestJoin testJoin = new TestJoin();
        Thread thread = new Thread(testJoin);
        thread.start();

        for (int i=0;i<1000;i++){
            if (i==200){
                try {
                    thread.join(); //插队
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
            System.out.println("main:"+i);
        }
    }
}
